cmake_minimum_required( VERSION 2.8 )
project(msckf_g2o_slam)


set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall  -O3  ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall   -O3 ")

set( CMAKE_CXX_FLAGS "-std=c++14" )

set(CMAKE_C_FLAGS "-pthread -std=gnu99")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")


find_package( OpenCV 3 REQUIRED )
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(Pangolin REQUIRED)
find_package(fast REQUIRED)

include_directories(
	${PROJECT_SOURCE_DIR}
	${PROJECT_SOURCE_DIR}/include
  	${OpenCV_INCLUDE_DIRS}
	${EIGEN3_INCLUDE_DIR}
	${Pangolin_INCLUDE_DIRS}
	${fast_INCLUDE_DIRS}
  )


#test mono
add_executable( msck_g2o_mono_test		msckf_g2o_mono_test.cpp
										src/Converter.cpp
										src/Frame.cpp
										src/FrameDrawer.cpp
										src/Initializer.cpp
										src/KeyFrame.cpp
										src/KeyFrameDatabase.cpp
										src/LocalMapping.cpp
										src/LoopClosing.cpp
										src/Map.cpp
										src/MapDrawer.cpp
										src/MapPoint.cpp
										src/Optimizer.cpp
										src/ORBextractor.cpp
										src/ORBmatcher.cpp
										src/PnPsolver.cpp
										src/Sim3Solver.cpp
										src/System.cpp
										src/Tracking.cpp
										src/Viewer.cpp
										src/corner_detector.cpp)

target_link_libraries(msck_g2o_mono_test 	${OpenCV_LIBS}
											${Pangolin_LIBRARIES}
											${EIGEN3_LIBS}
											${fast_LIBRARIES}
											${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so
											${PROJECT_SOURCE_DIR}/DBoW2/lib/libDBoW2.so)

#test stereo
add_executable( msck_g2o_stereo_test	msckf_g2o_stereo_test.cpp
										src/Converter.cpp
										src/Frame.cpp
										src/FrameDrawer.cpp
										src/Initializer.cpp
										src/KeyFrame.cpp
										src/KeyFrameDatabase.cpp
										src/LocalMapping.cpp
										src/LoopClosing.cpp
										src/Map.cpp
										src/MapDrawer.cpp
										src/MapPoint.cpp
										src/Optimizer.cpp
										src/ORBextractor.cpp
										src/ORBmatcher.cpp
										src/PnPsolver.cpp
										src/Sim3Solver.cpp
										src/System.cpp
										src/Tracking.cpp
										src/Viewer.cpp)

target_link_libraries(msck_g2o_stereo_test 	${OpenCV_LIBS}
											${Pangolin_LIBRARIES}
											${EIGEN3_LIBS}
											${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so
											${PROJECT_SOURCE_DIR}/DBoW2/lib/libDBoW2.so)

